A virtual machine system is a system that enables a plurality of OSs to operate. For example, there exist virtual machine systems, such as Xen® and KVM (Kernel-based Virtual Machine)®.
In a conventional virtual machine system, a plurality of OSs are booted after previously setting I/O devices to be occupied by each of the plurality of OSs. Then, a virtual machine monitor (VMM) allows access from each OS to a memory or a register of the I/O device which is occupied by the OS concerned, and denies access from each OS to a memory or a register of the I/O device which is occupied by other OS. When an I/O device is a PCI device (including a PCI Express device, which applies hereinafter), the virtual machine monitor allows or denies access to a PCI configuration register. Thus, exclusive allocation of an I/O device to each OS has been performed.
For example, in Xen, I/O devices to be occupied by an OS are specified in a configuration file, and in KVM, I/O devices to be occupied by an OS are specified in a start option of the OS.
In the conventional virtual machine system, such as Xen or KVM, it is necessary to previously set I/O devices to be occupied by each OS. Therefore, in the case where multiple OSs are operating and each OS occupies multiple I/O devices, the previous setting becomes complicated.
Patent Literature 1 discloses a virtual machine system that switches an OS occupying an I/O device, during execution by the way described below.
In the virtual machine system of Patent Literature 1, a VMM gives an I/O device occupancy permission to an OS, based on a factor such as an I/O device occupancy request from the OS or an event detection by the VMM. Then, the OS performs input/output to/from the I/O device only when obtaining the I/O device occupancy permission. Accordingly, it is not necessary to previously set the I/O device to be occupied by one of the OSs.
However, since a memory and a register of the I/O device are not protected, an OS which is not occupying the I/O device can access the memory and the register of the I/O device concerned. Therefore, there is a possibility that contents of a memory and a register of an I/O device being occupied by a certain OS may be destroyed by other OS.